package com.prezs.enums;

import lombok.Getter;

@Getter
public enum Gender {
	
	// 枚举常量
	FEMALE("0","女"),MALE("1","男");
	
    // 性别编码
	public String genderCode;
	// 性别名称
	public String genderName;
	
	private Gender(String genderCode,String genderName) {
		this.genderCode = genderCode;
		this.genderName = genderName;
	}
	
	/**
	 * 根据编码获取对应的枚举值
	 * @param genderCode 性别编码
	 * @return Gender对象
	 */
	public static Gender getEnumValue(String genderCode) {
		for (Gender value:values()) {
			if(value.getGenderCode().equals(genderCode)) {
				return value;
			}
		}
		return null;
	}
}
